/* *********
 *    Author: Jason He;
 *    Version: 0.0.1;
 *    Date: 2016-12-23;
 *    File: common.js;
 ********* */

$(document).ready(function () {
	// search
	$("#header-search-btn").click(function () {
		$("#search").show();
	});
	$("#search-close").click(function () {
		$("#search").hide();
		$("#search-input").val("");
	});
	$("#history-clear").click(function () {
	    $("#history").hide();
	    $.cookie('keysearchlog', null);
	});
	$("#search-do").click(function () {
	    $("#history").hide();
	    url = $("#buycar-btn").attr('href');
	    window.location.href = url + "&ke=" + $("#search-input").val();
	});
	// back to top
	var scrollTop = 0;
	$(window).scroll(function () {
		scrollTop = $(window).scrollTop();
		if (scrollTop >= 700) {
			$("#totop").show();
		} else {
			$("#totop").hide();
		}
	});
	$("#totop").click(function () {
		$("body").scrollTop(0);
	});
});